package com.gxa.hotel.core.exception;

/**
 * 声明一个描述异常类型和消息的枚举
 * @author bill
 * @date 2022/5/7 11:06
 */
public enum ExceptionCode {

    /**
     * 枚举要先把对象声明好,
     * 访问的时候,只能访问这些提前声明的对象
     *
     * 在枚举出现之前(1.5之前),要达到相同的效果得通过静态常量
     * public static final String SERVER_FAILED = "50001";
     * code 是企业自己的规定
     * 后续再需要自定义异常信息的时候,再添加
     * 枚举值用全大写(java规定),且是英文(企业规定)
     * 多个枚举值之间用逗号隔开
     * 枚举值把所有的备选项都先设计好, 使用时只能从它们中间获取
     *
     */
    SERVER_FAILED("50001","服务器开小差了,请稍后再试"),
    DUPLICATE_USERNAME("50002","重复的用户名"),
    DUPLICATE_PHONE("50003","重复的手机号"),
    ADMIN_LOGIN_FAILED("50004","管理员登录失败"),
    USER_LOGIN_FAILED("50005","用户登录失败,请检查用户手机号或密码"),
    USER_NOT_FONUD("50006","没有该用户,操作失败"),
    EMPTY_TOKEN("50007","token信息不能为空"),
    WRONG_TOKEN("50008","token校验不通过"),
    EMPTY_PHONE("50009","手机号不能为空"),
    EMPTY_PASSWORD("50010","密码不能为空"),
    IDENTITY_ERROR("50011","身份认证失败"),
    EXPIRE_CODE("50012","验证码已失效"),
    WRONG_CODE("50013","验证码错误"),
    WRONG_PHONE("50014","手机号码格式不合法"),
    WRONG_USER_STATUS("50015","当前用户非正常状态"),
    EMPTY_CODE("50016","验证码不能为空"),
    NULL_GOODS_ID("50017","没有该编号对应的商品信息"),
    WRONG_PAGE("50018","错误的页码"),


    ;

    private String code;
    private String message;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    ExceptionCode(String code, String message) {
        this.code = code;
        this.message = message;
    }
}
